﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebMainSite
{
    public partial class GetEnterpriseCode : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["SecretKey"]))
            {
                string secretKey = Request.QueryString["SecretKey"];
                MySite.Model.SecretKey_ID secretKeyModel = new MySite.Model.SecretKey_ID();
                MySite.BLL.SecretKey_ID secretKeyBll = new MySite.BLL.SecretKey_ID();
                bool flag = secretKeyBll.SecretKeyBeUsed(new Guid(secretKey));
                //密钥被占用
                if (flag)
                {
                    Response.Write("Beused");
                    return;
                }
                secretKeyModel = secretKeyBll.GetModel(new Guid(secretKey));
                if (secretKeyModel != null)
                    Response.Write(secretKeyModel.EnterpriserID);
                else
                    Response.Write("NotExist");//密钥不存在
            }
            else
                Response.Write("密钥为空！");
        }
    }
}